<template>
  <div class="container">
    <header>
      <router-link to="/" class="back-button">&lt;</router-link>
      <!-- <div class="title">理财选品地图</div> -->
      <h1>财富管理</h1>
      <button class="more-button">···</button>
    </header>
    <!-- <div class="header"> -->

      <div>
        <div class="carda" v-for="(card, index) in cards" :key="index" v-show="activeCard === index">
    <div class="main-content">
    </div>
  </div>
  <div class="cardb">
    <div class="login-section" v-if="!isLoggedIn">
      <p class="login-text">登录查看资产情况</p>
      <button class="button login-button" @click="login">点击登录</button>
    </div>
    <div class="info-section" v-else>
      <div class="info-container">
        <div class="info-item">
          <div class="info-label-container">
            <p class="info-label">总资产 (折算人民币)</p>
            <span @click="toggleMask(1)">
              <img :src="getEyeIcon(1)" alt="Eye Icon" class="eye-icon" />
            </span>
          </div>
          <p v-if="!cards[1].isMasked" class="info-value">{{ totalAssets }}</p>
          <p v-else class="info-value">******</p>
        </div>
        <div class="info-item">
          <p class="info-label">昨日收益 (元)</p>
          <p v-if="!cards[1].isMasked" class="info-value">{{ yesterdayEarnings }} &gt;</p>
          <p v-else class="info-value">******</p>
        </div>
      </div>
    </div>
  </div>
      <!-- </div>
  -->
    </div>
    <div class="card flex-container">
      <div class="icon-item" @click="navigateTo('/finance')" title="理财">
        <img class="btn-img" src="./assets_page3/pig.svg" />

        <!-- <span>理财</span> -->
        <router-link to="/pick">理财</router-link>
      </div>
      <div class="icon-item" @click="navigateTo('/fund')" title="基金">
        <img class="btn-img" src="./assets_page3/jijin.svg" />

        <!-- <span>基金</span> -->
        <router-link to="/load">基金</router-link>
      </div>
      <div class="icon-item" @click="navigateTo('/risk-evaluation')" title="风险评估">
        <img class="btn-img" src="./assets_page3/fengxian.svg" />

        <!-- <span>风险评估</span> -->
        <router-link to="/RiskIndex">风险评估</router-link>
      </div>
      <div class="icon-item" @click="navigateTo('/more')" title="更多">
        <img class="btn-img" src="./assets_page3/more.svg" />

        <!-- <span>更多</span> -->
        <router-link to="/load">更多</router-link>
      </div>
    </div>

    <div style="text-align: left;">
      <h3>财富精选</h3>
    </div>

    <div class="layout-container">
      <div class="main-card flexible-card">
        <div class="card-header special-card-header">灵活理财</div>
        <div class="main-content">
          <p class="rate1">1.719%</p>
          <p>近七日年化</p>
          <div class="tags1">
            <span>中低风险</span>
            <span>每日开放</span>
          </div>
          <!-- <a href="#" class="info-button">了解更多 ></a> -->
          <router-link to="/pick" class="info-button">了解更多 ></router-link>
        </div>
      </div>
      <div class="side-cards">
        <div class="side-card1">
          <div class="card-header special-card-header">稳健理财</div>
          <div class="main-content">
            <p class="rate2">2.40% - 3.20%</p>
            <div class="tags2">
              <p style="font-size: 10px; font-family: 'Microsoft YaHei', sans-serif;">业绩比较基准</p>
              <span>每月可赎</span>
              <span>中低风险</span>

            </div>
          </div>
        </div>
        <router-link to="/load">
          <div class="side-card2">
            <div class="card-header special-card-header">优选基金</div>
            <div class="main-content">
              <p class="rate3">10.36%</p>
              <div class="tags3">
                <p style="font-size: 10px; font-family: 'Microsoft YaHei', sans-serif;">近一年跌涨幅</p>
                <span>T+3赎回</span>
                <span>高风险</span>
              </div>
            </div>
          </div>
        </router-link>

      </div>
    </div>

    <router-link to="/baogao">
      <div class="wealth-card">
        <div class="content">

        </div>
        <div class="image-container">
          <div class="image" style="display: flex; flex-direction: column;">
            <!-- <img src="./assets_page3/youxiajiao.png" alt="财富图" />
          <img src="./assets_page3/youxiajiao (2).png" alt="财富图" /> -->
          </div>
          <div class="bottom-left-image">
            <!-- <img src="./assets_page3/zuoxiajiao.png" alt="新图片" class="small-image positioned-image" /> -->
          </div>
        </div>
      </div>
    </router-link>
    <!-- 插入新的热点推荐卡片 -->
    <div style="text-align: left;">
      <h3>财富资讯</h3>
    </div>

    <div class="layout-container">
      <div class="main-card2" @click="goToCommunity(0)">
        <!-- <div class="card-header">热点推荐</div> -->
        <!-- <div class="list"> -->
        <!-- <div class="item">
            <span class="item-number">1</span>历史上首个“特大地震...<span class="item-label label-explosion">爆</span>
          </div>
          <div class="item">
            <span class="item-number">2</span>巴黎奥运会落幕式...<span class="item-label label-hot">热</span>
          </div>
          <div class="item">
            <span class="item-number">3</span>养老新选择！找不到...<span class="item-label label-new">新</span>
          </div> -->
        <!-- <a href="#" class="link">更多热点 ></a> -->
        <!-- <span class="link">更多热点 ></span> -->
        <!-- </div> -->

      </div>
      <div class="side-cards">

        <div class="side-card card3" @click="goToCommunity(1)"></div>
        <!-- <div class="side-card card3"></div> -->
        <div class="side-card card4" @click="goToCommunity(2)"></div>
      </div>
      <div></div>

    </div>
    <div class="watermark">
      <img src="..page4/assets_page3/tidaishuiyin.svg" alt="Watermark" />
    </div>
  </div>
</template>
<script>import { library } from '@fortawesome/fontawesome-svg-core';
import { fas } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';

import openEyeIcon from './assets_page3/open-eye.svg';
import closedEyeIcon from './assets_page3/closed-eye.svg';

library.add(fas);

export default {
  components: {
    FontAwesomeIcon,
  },
  data() {
    return {
      isLoggedIn: false,
      totalAssets: '999,999.99',
      yesterdayEarnings: '10,000.00',
      cards: [
        { title: 'Card 1', content: 'Content 1', isMasked: false },
        { title: 'Card 2', content: 'Content 2', isMasked: false },
      ],
      activeCard: 1, // 假设当前激活的卡片是第二个
      eyeIcons: [
        openEyeIcon,
        closedEyeIcon,
      ],
    };
  },
  methods: {
    login() {
      this.isLoggedIn = true; // 切换为已登录状态
      this.activeCard = 1; // 设置激活的卡片为第二个
      this.cards[1].isMasked = true; // 设置第二个卡片的 isMasked 为 true
    },
    goToCommunity(tabIndex) {
      this.$router.push({ path: '/community', query: { tab: tabIndex } });
    },
    toggleMask(index) {
      this.cards[index].isMasked = !this.cards[index].isMasked; // 切换显示/隐藏状态
      this.activeCard = index; // 切换当前激活的卡片
    },
    getEyeIcon(index) {
      return this.cards[index].isMasked ? closedEyeIcon : openEyeIcon; // 根据是否隐藏返回对应的图标
    },
  },
};

</script>
<style scoped>
header {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  /* padding-bottom: 16px; */
}

h1 {
  padding: 0 20px;
  font-size: 20px;
  /* font-weight: bold; */
  color: #444;
}

.back-button {
  position: absolute;
  left: 15px;
  font-size: 24px;
  background: none;
  border: none;
  cursor: pointer;
}

.more-button {
  position: absolute;
  right: 0;
  font-size: 24px;
  background: none;
  border: none;
  cursor: pointer;
}

/* 登录文本的样式 */
.login-text {
  font-family: 'SimHei', sans-serif;
  /* 黑体字体 */
  font-size: 28px;
  /* 字体大小 */
  padding:10px;
}

/* 登录部分的样式 */
.login-section {
  padding-top: -100px;
  /* 顶部内边距，使按钮向下移动 */
}


.login-button {
    background-color: #8EC039;
    color: white;
    font-family: 'SimHei', sans-serif;
    border-radius: 10px;
    font-size: 19px;
    border: #8EC039;
    padding: 12px;
    margin-top: -21px;
}
/* 登录按钮悬停时的样式 */
.login-button:hover {
  background-color: #45a049;
  /* 鼠标悬停时的背景颜色 */
}

.card {
  width: 280px;

  background: white;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 7px;
}

.cardb {
  /* width: 280px; */
  width: 100%;
     height: 156px;
    margin-top: 11px;
  /* 设置上边距 */
  margin-bottom: 20px;
  /* 设置上边距 */
  background-image: url('./assets_page3/dingbu.png');
  border-radius: 10px;
  /* 圆角 */
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 1;
  position: relative;
  overflow: hidden;
}

.carda {
  width: 100%;

  background: white;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 7px;
}

.info-section {
  background-color: #E5F1D1;
  border-radius: 0px;
  width: 100%;
  height: 180px;
  /* 设置高度 */

}

.info-container {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  font-size: 14px;
}

.info-container div {
  text-align: center;
}

.asset-info,
.earnings-info {
  padding: 10px;
}
.info-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-bottom: 10px;
}

.info-label {
  font-family: 'Microsoft YaHei', sans-serif;
  font-size: 20px;
  color: #333;
  margin-bottom: -30px;
  margin-top: 40px;
  margin-right: 10px;
  height: 50px;
}
.info-label-container {
  display: flex;
  align-items: center;
}
.eye-icon {
  margin-top: 20px;
  width: 20px;
  height: 40px;
}
.info-value {
  font-family: 'Microsoft YaHei', sans-serif;
  font-size: 20px;
  color: #000;
}
.small-image {
  width: 50px;
  height: auto;
}

.positioned-image {
  margin-left: -800px;
}

.image-container {
  position: relative;
  display: flex;
  justify-content: left;
}

.image {
  display: flex;
  flex-direction: column;
}

.bottom-left-image {
  position: absolute;
  bottom: 0;
  left: 0;
}

.container {
  /* width: 100%;
  max-width: 400px; */
  margin: 0;
  padding: 10px 10px 10px 10px;
  /* 保持其他方向的 padding 不变 */
  padding-top: 30px;
  /* 增加 padding-top 来上调内部组件 */
  background: url('./assets_page3/bg.svg');
  /* 修改背景为 SVG 图像 */
  background-size: cover;
  /* 根据需要调整背景大小 */
  background-repeat: no-repeat;
  /* 防止背景重复 */
  background-position: center;
  /* 背景图像居中 */
}

/* 或者使用 margin-top 来实现 */
.container>* {
  margin-top: -10px;
  /* 使用负 margin-top 来上调内部组件 */
}

.card-header {

  font-family: "Microsoft YaHei", sans-serif;
  /* 设置字体为微软雅黑 */
  font-weight: bold;
  padding: 10px;
  border-radius: 5px;
  text-align: left;
  /* 设置文本左对齐 */
  margin-bottom: -100px;
  font-size: 14px;
}


/* 卡片标题背景图 */
.card-header::after {
  content: '';
  /* 伪元素必须有 content 属性 */
  position: absolute;
  top: 0;
  right: 0;
  /* 调整这个值来控制背景的位置 */
  bottom: 100;
  left: 100%;
  /* 背景在文字后面 */
  background-image: url('./assets_page3/zitibeijingtu.svg');
  background-size: contain;
  /* 根据需要调整背景大小 */
  background-repeat: no-repeat;
  background-position: right;
  /* 背景图像靠右 */
}

.card-header span {
  margin-left: 10px;
  font-size: 1em;

}

/* .header {
  width: 100%;
  height: 240px;
  background-image: url('./assets_page3/dingbu.svg');
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 1;
  position: relative;
  overflow: hidden;
} */


.header h2 {
  font-size: 12px;
  text-align: center;
  margin: 20px auto;
  padding-top: 60px;
}

.header button {
  background-color: #4aa44a;
  border: none;
  padding: 10px 10px;
  cursor: pointer;
  border-radius: 5px;
}

.icon-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  margin: 10px;
}

.flexible-card {
  position: relative;
  /* background-image: url('./assets_page3/zitibeijingtu.svg'); */
  background-size: contain;
  /* 确保图片完整显示 */
  background-repeat: no-repeat;
  background-position: center;
  /* 调整为适当位置 */
}

/* 灵活理财卡片 */
.flex-container {
  display: flex;
  width: 100%;
  justify-content: space-around;
  flex-wrap: wrap;
}

.layout-container {
  display: flex;
  justify-content: space-between;
  padding: -1px;
margin-top: 5px;
}

/* 灵活理财卡片 */
.main-card {
  background-image: url('./assets_page3/lhlc.svg');
  /* 替换为你的背景图片路径 */
  background-size: 200%;
  /* 使背景图片覆盖整个卡片 */
  background-repeat: no-repeat;
  /* 防止背景重复 */
  background-position: center;
  /* 背景图像居中 */
  border-radius: 10px;
  padding: 2px;
  flex: 1;
  margin-right: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  height: 184px;
}

/*  */
.main-card2 {
  background-image: url('./assets_page3/edtj.svg');
  /* 替换为你的背景图片路径 */
  background-size: 100%;
  /* 使背景图片覆盖整个卡片 */
  background-repeat: no-repeat;
  /* 防止背景重复 */
  background-position: center;
  /* 背景图像居中 */
  border-radius: 10px;
  padding: 2px;
  flex: 1;
  margin-right: 10px;
  /* box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); */
  height: 170px;

}

.side-cards {

  display: flex;
  flex-direction: column;
  flex: 1;
}

.special-card-header {
  font-weight: bold;
  padding: 10px;
  /* 根据需要调整内边距 */
  border-radius: 5px;
  /* 圆角边框 */
  text-align: center;
  /* 文本居中对齐 */
  font-size: 13px;
  /* 设置字体大小 */
  font-family: "Microsoft YaHei", sans-serif;
  /* 设置字体为微软雅黑 */
  color: white;
  /* 设置字体颜色 */
  background-image: url('./assets_page3/background.svg');
  /* 设置SVG背景图像 */
  background-size: contain;
  /* 使背景图像适应盒子尺寸 */
  background-repeat: no-repeat;
  /* 防止背景重复 */
  background-position: center;
  /* 背景图像居中 */
  max-width: 100%;
  /* 限制最大宽度，确保不超过卡片宽度 */
  box-sizing: border-box;
  /* 确保宽度包括内边距和边框 */
  display: flex;
  align-items: center;
  /* 垂直居中文本 */
  justify-content: center;
  /* 水平居中文本 */
  margin-top: 0;
  /* 移除上边距 */
  height: auto;
  /* 自动高度，根据内容调整 */
}

.side-card1 {
  background-image: url('./assets_page3/wjlc.svg');
  /* 替换为你的背景图片路径 */
  background-size: 200%;
  /* 使背景图片覆盖整个卡片 */
  background-repeat: no-repeat;
  /* 防止背景重复 */
  background-position: center;
  /* 背景图像居中 */
  border-radius: 10px;
  padding: 2px;
  margin-bottom: 5px !important;
  /* 使用 !important 增加优先级 */
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  height: 86px;
}

.side-card2 {
  background-image: url('./assets_page3/yxjj.svg');
  /* 替换为你的背景图片路径 */
  background-size: 200%;
  /* 使背景图片覆盖整个卡片 */
  background-repeat: no-repeat;
  /* 防止背景重复 */
  background-position: center;
  /* 背景图像居中 */
  border-radius: 10px;
  padding: 2px;
  margin-bottom: 5px !important;
  /* 使用 !important 增加优先级 */
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  height: 86px;
}

.card3 {
  /* 为card3特定的样式 */
  background-image: url('./assets_page3/haibao2.svg');
  /* 替换为你的背景图片路径 */
  background-size: cover;
  /* 使背景图片覆盖整个卡片 */
  background-repeat: no-repeat;
  /* 防止背景重复 */
  background-position: center;
  /* 背景图像居中 */
  border-radius: 10px;
  padding: 0px;
  margin-bottom: 5px !important;
  /* 使用 !important 增加优先级 */
  /* box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); */
  height: 90px;
}

.card4 {
  /* 为card4特定的样式 */
  background-image: url('./assets_page3/haibao1.svg');
  /* 替换为你的背景图片路径 */
  background-size: 100%;
  /* 使背景图片覆盖整个卡片 */
  background-repeat: no-repeat;
  /* 防止背景重复 */
  background-position: center;
  /* 背景图像居中 */
  border-radius: 10px;
  padding: 0px;
  margin-bottom: 5px !important;
  /* 使用 !important 增加优先级 */
  /* box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); */
  height: 86px;
  /* height: auto; */
}

.card-header {
  font-weight: bold;
  padding: 2px;
  border-radius: 5px;
  text-align: center;
  margin-bottom: 2px;
}

.main-content {
  text-align: center;
  line-height: 0.8;
  /* 调整行高，缩小字体间距 */

}

.rate1 {
  font-size: 30px;
  color: #e74c3c;
  margin: 18px 0;
  line-height: 1;
  /* 调整行高，缩小字体间距 */
  font-family: "Microsoft YaHei", sans-serif;
  /* 设置字体为微软雅黑，备用字体为无衬线字体 */
  font-weight: bold;
  /* 设置字体为粗体 */
}

.rate2 {
  font-size: 16px;
  color: #e74c3c;
  margin: 5px 0;
  margin-top: 5px;
  /* 单独设置顶部外边距 */
  margin-bottom: -7px;
  /* 单独设置底部外边距 */
  line-height: 1;
  /* 调整行高，缩小字体间距 */
  font-family: "Microsoft YaHei", sans-serif;
  /* 设置字体为微软雅黑，备用字体为无衬线字体 */
  font-weight: bold;
  /* 设置字体为粗体 */
}

.rate3 {
  font-size: 16px;
  color: #e74c3c;
  margin: 5px 0;
  margin-top: 5px;
  /* 单独设置顶部外边距 */
  margin-bottom: -7px;
  /* 单独设置底部外边距 */
  line-height: 1;
  /* 调整行高，缩小字体间距 */
  font-family: "Microsoft YaHei", sans-serif;
  /* 设置字体为微软雅黑，备用字体为无衬线字体 */
  font-weight: bold;
  /* 设置字体为粗体 */
}

/* main.css */
.tags1 span {
  display: inline-block;
  /* 保持并列 */
  background-color: #f1c40f;
  /* 背景颜色 */
  color: black;
  /* 字体颜色 */
  padding: 5px 6px;
  /* 内边距 */
  border-radius: 5px;
  /* 圆角 */
  margin: 1px 4px;
  /* 增加水平间距 */
  font-size: 10px;
  /* 字体大小 */
  line-height: 1;
  /* 紧凑的行高 */
}

.tags2 span {
  display: inline-block;
  /* 保持并列 */
  background-color: #f1f1f1;
  /* 背景颜色 */
  color: #0b0202;
  /* 字体颜色 */
  padding: 5px 6px;
  /* 内边距 */
  border-radius: 5px;
  /* 圆角 */
  margin: 1px 4px;
  /* 增加水平间距 */
  font-size: 10px;
  /* 字体大小 */
  line-height: 1;
  /* 紧凑的行高 */

}

.tags3 span {
  display: inline-block;
  /* 保持并列 */
  background-color: #f1f1f1;
  /* 背景颜色 */
  color: #0b0202;
  /* 字体颜色 */
  padding: 5px 6px;
  /* 内边距 */
  border-radius: 10px;
  /* 圆角 */
  margin: 1px 4px;
  /* 增加水平间距 */
  font-size: 10px;
  /* 字体大小 */
  line-height: 1;
  /* 紧凑的行高 */

}


.info-button {
  display: inline-block;
  margin-top: 10px;
  padding: 10px 15px;
  background-color: #f1f1f1;
  color: black;
  border-radius: 10px;
  text-decoration: none;
  font-size: 15px;
}

.wealth-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-image: url('./assets_page3/cftgt.png');
  /* 确保路径正确 */
  background-size: contain;
  /* 背景图像完整显示 */
  background-position: center;
  /* 背景图像居中对齐 */
  background-repeat: no-repeat;
  /* 避免重复 */
  border-radius: 10px;
  padding: 1px;
  margin: 1px 0;
  width: 100%;
  /* 设置宽度 */
  height: 150px;
  /* 设置高度 */
}


.content {
  flex: 1;
}

.content h3 {
  font-size: 20px;
  color: #433333;
  margin: 0;
  font-weight: bold;
  white-space: nowrap;
  /* 确保文本不换行 */
}

.content p {
  color: #555;
  margin: 10px 0;
  line-height: 1;
  /* 调整行高，缩小字体间距 */
}

.action-button {
  display: inline-block;
  padding: 10px 20px;
  background-color: #e5e3e0;
  color: rgb(237, 204, 222);

  border: none;
  border-radius: 15px;
  cursor: pointer;
  text-align: center;
}

.image {
  flex-shrink: 0;
  margin-left: 20px;
}

.image img {
  width: 100px;
  height: auto;
}

.footer {
  text-align: center;
  margin-top: 20px;
}

.large-icon {
  font-size: 1em;
}

.more-hotspots {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.more-hotspots .info-button {
  margin-left: auto;
}

.list {
  background-color: #fff;
  border-radius: 10px;
  padding: 1px;
  margin-bottom: 10px;
  margin-top: 0px;
}

.item {
  display: flex;
  align-items: center;
  margin-bottom: 5px;
  font-size: 14px;
  height: 40px;
  line-height: 1.5;
  /* 设置行高为字体大小的1.5倍 */
  padding: 5px 0;
  /* 调整内边距 */
  box-sizing: border-box;
  /* 确保高度包括内边距 */
}

.item-number {
  color: #e74c3c;
  margin-right: 5px;
}

.item-label {
  color: #fff;
  border-radius: 12px;
  padding: 2px 6px;
  font-size: 8px;
  margin-left: auto;
}

.label-explosion {
  background-color: #e74c3c;
}

.label-hot {
  background-color: #e74c3c;
}

.label-new {
  background-color: #3498db;
}

.link {
  text-align: right;
  color: #3498db;
  text-decoration: none;
  display: inline-block;
  height: 80%;
}

.watermark {
  position: relative;
  bottom: -10px;
  left: 0;
  width: 100%;
  height: 45px;
  text-align: center;
  opacity: 0.3;
  z-index: 0;
}

.watermark img {
  width: auto;
  height: 100%;
}
</style>
